<!DOCTYPE html>
<html lang="zh-CN"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorator="model/boardModel">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

  <title>用户列表</title>
  <script th:src="@{/model/confirm.js}"></script>
  <script type="text/javascript">
    $(function() {
      $("#del").deleteFun();
    });
  </script>
</head>
<body>

  <div th:fragment="pagenav" th:remove="tag">
    <div th:replace="model/nav :: pageheader ('用户管理','用户管理')"></div>
  </div>

  <div th:fragment="content" th:remove="tag">


    <div class="row">
      <div class="col-xs-12">

        <div class="box box-primary">
          <div class="box-header with-border">
            <h3 class="box-title">查询条件</h3>
            <div class="box-tools pull-right">
              <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
            </div>
          </div>
          <!-- /.box-header -->
          <!-- form start -->
          <form role="form" th:action="@{/user/info}" th:object="${sysUserInfo}" th:formmethod="post" >
            <div class="box-body">
              <div class="row">

                <div class="col-xs-3">
                  <input type="text" th:name="userName" th:value="*{userName}" class="form-control input-sm" placeholder="账户"/>
                </div>
                <div class="col-xs-3">
                  <input type="text" th:name="nickName" class="form-control input-sm" placeholder="姓名"/>
                </div>
                <div class="col-xs-3">
                  <input type="text" th:name="phone" class="form-control input-sm" placeholder="电话"/>
                </div>

                <div class="col-xs-3">
                  <button type="submit" class="btn btn-primary pull-right btn-sm">查询</button>
                </div>
              </div>
            </div>
            <!-- /.box-body -->

            <div class="box-footer">

            </div>
          </form>
        </div>


      <div class="box">
        <div class="box-header">
          <h3 class="box-title">用户列表</h3>

          <div class="box-tools">
            <a href="/user/add"><button type="button" class="btn btn-primary btn-sm" onclick="">新增</button></a>
          </div>

        </div>

        <!-- /.box-header -->
        <div class="box-body">
          <table id="dataTable" class="table table-striped table-bordered table-hover table-condensed">

            <thead >
            <tr>
              <th>账户</th>
              <th>名称</th>
              <th>电话</th>
              <th>状态</th>
              <th>备注</th>
              <th>创建时间</th>
              <th>操作</th>
            </tr>
            </thead>

            <tbody>
            <tr th:each="obj : ${datas.list}">
              <td th:text="${obj.userName}"></td>
              <td th:text="${obj.nickName}"></td>
              <td th:text="${obj.phone}"></td>
              <td>
                <div th:switch="${obj.status}" th:remove="tag">
                  <p th:case="1"><span class="label label-success">正常</span></p>
                  <p th:case="*"><span class="label label-danger">停用</span></p>
                </div>
              </td>
              <td th:text="${obj.memo}"></td>
              <td th:text="${obj.createTimeStr}"></td>

              <td>
                <div class="btn-group">
                  <a th:href="@{'/user/edit/'+${obj.userId}}"><button type="button" class="btn btn-primary btn-sm"  placeholder="编辑"><i class="fa fa-edit"></i></button></a>
                  <a th:href="@{'/user/edit/'+${obj.userId}}"><button type="button" class="btn btn-primary btn-sm" placeholder="授权"><i class="fa fa-cogs"></i></button></a>
                  <a th:href="@{'/user/'+${obj.userId}} " th:id="del" th:title="确定删除"><button type="button" class="btn btn-danger btn-sm" placeholder="删除"><i class="fa fa-times-circle"></i></button></a>
                </div>
              </td>

            </tr>


            </tbody>

          </table>

          <div th:include="model/page :: pager" th:remove="tag"></div>

        </div>
        <!-- /.box-body -->
      </div>
      <!-- /.box -->
    </div>
  </div>
  </div>
  <!-- DataTables -->
  <script th:src="@{/plugins/datatables/jquery.dataTables.min.js}"></script>
  <script th:src="@{/plugins/datatables/dataTables.bootstrap.min.js}"></script>



</body>
</html>